package com.stox.audit;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.EntityListeners;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import lombok.Data;
import lombok.EqualsAndHashCode;

import org.springframework.data.jpa.domain.AbstractPersistable;

@Data
@MappedSuperclass
@EqualsAndHashCode(callSuper=true)
@EntityListeners(AuditableEntityListener.class)
public abstract class AbstractAuditable<U, PK extends Serializable> extends AbstractPersistable<PK> implements Auditable<U>{
	private static final long serialVersionUID = 1L;

	@ManyToOne
	private U createdBy;
	
	@ManyToOne
	private U lastModifiedBy;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date createdDate;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date lastModifiedDate;
	
}
